﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MockPrjTeam2.Biz;

namespace AbServiceDirectory
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        private readonly SDManager _sdManager = new SDManager();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["username"] != null)
            {
                _lbtUserName.Text = Session.Contents["username"].ToString();
            }
            else
            {
                Response.Redirect("/Pages/Forms/Login.aspx");
            }
        }

        protected void LbtnLogout_Click(object sender, EventArgs e)
        {
            Session["username"] = _sdManager.LogOutAccount(Session["username"].ToString());
            Session.Abandon();
            Session.Clear();

            Response.Redirect("/Pages/Forms/Login.aspx");
        }
    }
}
